package heima_case;

public class PlaneTicket {
    public static void main(String[] args) {
        double Price = calculate(1000, 8, "经济舱");
        System.out.println("优惠价是：" + Price);
    }

    public static double calculate(double price, int month, String type){
        if(month >= 5 && month <= 10){
            switch (type){
                case "头等舱":
                    price = price * 0.9;
                    break;
                case "经济舱":
                    price = price * 0.85;
                    break;
            }
        }
        else {
            switch (type){
                            case "头等舱":
                                price = price * 0.9;
                                break;
                            case "经济舱":
                                price = price * 0.85;
                                break;
            }
        }
        return price;
    }
}
